using System;
using ODT.Common.Core;

namespace PPTerminalControl
{
	public class ControlProperties : ITerminalControl
	{
		private static int terminalbuffer;

		private static int numcommands;

		private static int echomode;

		private static bool bShowResponseTime;

		[LocalizedCategory("Common.CommunicationCategoryName")]
		[LocalizedDisplayName("Terminal.EchoModeName")]
		[LocalizedDescription("Terminal.EchoModeDescription")]
		public int EchoMode
		{
			get
			{
				return echomode;
			}
			set
			{
				try
				{
					if (value < 0 || value > 255)
					{
						throw new ArgumentException("Valid echo modes are between 00000000 and 11111111");
					}
				}
				catch
				{
					value = 0;
				}
				echomode = value;
			}
		}

		[LocalizedCategory("Common.CommunicationCategoryName")]
		[LocalizedDisplayName("Terminal.ShowResponseTimeName")]
		[LocalizedDescription("Terminal.ShowResponseTimeDescription")]
		public bool ShowResponseTime
		{
			get
			{
				return bShowResponseTime;
			}
			set
			{
				bShowResponseTime = value;
			}
		}

		[LocalizedCategory("Common.ControlPropertiesCategoryName")]
		[LocalizedDisplayName("Terminal.TerminalBufferLinesName")]
		[LocalizedDescription("Terminal.TerminalBufferLinesDescription")]
		public int TerminalBufferLines
		{
			get
			{
				return terminalbuffer;
			}
			set
			{
				terminalbuffer = value;
			}
		}

		[LocalizedCategory("Common.ControlPropertiesCategoryName")]
		[LocalizedDisplayName("Terminal.CommandsName")]
		[LocalizedDescription("Terminal.CommandsDescription")]
		public int Commands
		{
			get
			{
				return numcommands;
			}
			set
			{
				numcommands = value;
			}
		}
	}
}
